import request from '@/utils/request'

//统一字典下拉框查询
export function adminDict(params) {
  return request({
      url: `common/v1/adminDict`,
      method: 'get',
      params
  })
}

export function getList(params) {
  return request({
    url: '/user/v1/list',
    method: 'get',
    params
  })
}

//删除账号
export function getDelete(id) {
    return request({
      url: `/user/v1/${id}`,
      method: 'DELETE'
    })
}
//新建子账号

export function addRole(params) {
  return request({
    url: '/user/v1',
    method: 'post',
    params
  })
}
//查询角色下拉框  
export function getRole() {
    return request({
      url: '/system/role/v1/roleDownSelect',
      method: 'get',
    })
  }
//禁用账号
export function setStatus(params) {
    return request({
      url: '/user/v1/status',
      method: 'put',
      params
    })
}

//重置密码
export function resetPassword(id) {
  return request({
    url: `/user/v1/reset/password/${id}`,
    method: 'put',
    id
  })
}

//查询用户帐号 
export function getUserDetail(id) {
  return request({
    url: `/user/v1/${id}`,
    method: 'get',
  })
}
//更新用户帐号
export function editUser(params) {
  return request({
    url: '/user/v1',
    method: 'put',
    params
  })
}


//修改密码
export function setPassword(params) {
    return request({
      url: '/user/v1/password',
      method: 'put',
      params
    })
}

//查询角色下拉框
export function selectRole() {
  return request({
    url: '/role/v1/select',
    method: 'get',
  })
}

// 查询权限菜单
export function getMenus() {
  return request({
    url: '/role/v1/menus',
    method: 'get',
  })
}
//新增角色
export function addRolePermissions(data) {
  return request({
    url: '/role/v1/',
    method: 'post',
    data
  })
}
//查询角色分页
export function getRoleList() {
  return request({
    url: '/role/v1/list',
    method: 'get',
  })
}
//查询角色拥有权限菜单
export function getRoleMenus(id) {
  return request({
    url: `/role/v1/menus/${id}`,
    method: 'get',
  })
}

// 更新角色权限信息
export function editMenus(data) {
  return request({
    url: `/role/v1/menus/`,
    method: 'PUT',
    data
  })
}

//更新角色
export function editRoleName(params) {
  return request({
    url: `/role/v1/`,
    method: 'PUT',
    params
  })
}

//删除角色
export function deleteRole(id) {
  return request({
    url: `/role/v1/${id}`,
    method: 'DELETE'
  })
}
